//
//  CLGloble.h
//  chanlin
//
//  Created by Ryan on 14-11-1.
//  Copyright (c) 2014年 chanlin. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Sgr_macro.h"
#import <UIKit/UIKit.h>
#import "CLUser.h"


#define IFiphone62iphone6p 1.104f

#define IFImageNameFit(ip5s) [[IFFrameAndFont sharedInstance] figImagName:ip5s]

#define IFScreenFit(ip5s,ip6,ip6p) ((GlobleWidth==375)?ip6:((GlobleWidth==414)?ip6p:ip5s))

#define IFScreenFitF(ip4s,ip5s,ip6,ip6p) ((GlobleWidth==375)?ip6:((GlobleWidth==414)?ip6p:(GlobleHeight==568?ip5s:ip4s)))

#define IFFitFloat(ip5s) (ip5s/320.f*GlobleWidth)

#define IFScreenFit2(ip5s,ip6) IFScreenFit(ip5s,ip6,((ip6)*IFiphone62iphone6p))

#define IFScreenFit2s(ip5s) IFScreenFit(ip5s,ip5s,((ip5s)*IFiphone62iphone6p))

#define GlobleWidth  [CLGloble sharedInstance].globleWidth
#define GlobleHeight [CLGloble sharedInstance].globleHeight

#define JRefrashTableBottomMoreView_Height 50.0
#define JRefrashTableBottomMoreViewIgnore_Height 15.0
#define INDEX_CELL_LEFT_MARGIN (11)

#define SCREEN_4 [[CLGloble sharedInstance] systemScreen_4]
#define AtLeastIOS8 [[CLGloble sharedInstance] systemVersionAtLeastIOS8]

#define GlobleIndexTableY 65.f

#define CHANNELCOUNT 25

#define UMSYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(v) ([[[UIDevice currentDevice] systemVersion] compare:v options:NSNumericSearch] != NSOrderedAscending)
#define _IPHONE80_ 80000

#define menus_dic @"menus_dic"
#define menus_order @"menus_order"

#define KeyOfUserHelpShow @"userHelpShowComplete"

@class IFMoviePlayerController;
@class CLPushWindow;

@interface CLGloble : NSObject

SGR_SINGLETION(CLGloble)

@property (nonatomic,strong)NSObject *dispatchLock;
@property (nonatomic,strong)NSDictionary *urls;
@property (nonatomic,strong)NSDictionary *menus;
@property (nonatomic,unsafe_unretained)float globleHeight;
@property (nonatomic,unsafe_unretained)float globleWidth;
@property (nonatomic,strong)NSArray *defaultOrderMenuItems;
@property (nonatomic,strong)CLUser *user;
@property (nonatomic,unsafe_unretained)BOOL isShowKeyBord;

@property (nonatomic,strong) IFMoviePlayerController *singleMovie;

@property (nonatomic,strong) CLPushWindow *pushWindow;

@property (nonatomic,strong)UIImage *topciIcon;
@property (nonatomic,strong)UIImage *slideIcon;
@property (nonatomic,strong)UIImage *videoIcon;
@property (nonatomic,strong)UIImage *audioIcon;
@property (nonatomic,strong)UIImage *liveIcon;

@property (nonatomic,strong)NSArray *keyOrder;

@property (nonatomic,strong)NSArray *levelIcons;

@property (nonatomic,strong)NSString *magazineName;
@property (nonatomic,strong)NSString *magazineId;

@property (nonatomic,strong ) NSDictionary *change;


@property (nonatomic,assign) int helpShow;

@property(nonatomic,assign,getter = isLastestRelease)BOOL lastestRelease;// 当前版本是否是最新发行版

@property (nonatomic,strong) NSDateFormatter *formatter;

@property (nonatomic,strong) NSMutableSet *supports;


- (NSString *)objChange:(NSString *)oldKey;

- (BOOL)isLogin;

- (BOOL)checkAnimationLock:(NSObject *)lock;

- (void)cleanAnimationLock;

- (UIWindow *)getMainWindow;

- (CLBaseViewController *)currentController;

- (void)showTieAlertMessage:(NSString *)message subMessage:(NSString *)subMessage;



- (void)showTieSuccessMessage:(NSString *)message subMessage:(NSString *)subMessage;

- (void)showTieUnCollectMessage:(NSString *)message subMessage:(NSString *)subMessage;

- (void)didChangeToInterfaceOrientationPortrait;

- (BOOL)systemScreen_4;

- (NSString *)stringFromJson:(NSObject *)obj;
- (NSObject *)jsonFromString:(NSString *)str;
- (BOOL)systemVersionAtLeastIOS8;

- (CGSize)calculateSizeWithFont:(UIFont *)font
                       withText:(NSString *)text
                    withMaxSize:(CGSize)maxSize
                  withLineSpace:(float)lineSpace
                withAllowIndent:(BOOL)allowIndent;

- (BOOL)checkOnLine;

-(NSString *)appVersion;

- (void)setUserHelpShowStatu:(BOOL)complete;

- (BOOL)isUserHelpShowComplete;

- (void)showAlertWithTitle:(NSString *)title message:(NSString *)message block:(void(^)(int buttonIndex))block cancelButtonTitle:(NSString *)cancelButtonTitle button1:(NSString *)button1 button2:(NSString *)button2;

- (void)showAlertWithTitle:(NSString *)title message:(NSString *)message block:(void(^)(int buttonIndex))block cancelButtonTitle:(NSString *)cancelButtonTitle confirmButtonTitles:(NSString *)confirmButtonTitles;

- (UIImage *)getTodyLogo;

- (NSString *)md5:(NSString *)seed;

- (UIImage *)captureView:(UIView *)aview;

- (void)clearMovie;

- (void)doPush:(int) type docId:(NSString *)did;

- (NSArray *)allKeys;

- (void)reflash;
@end
